var empty_object={};
var stooge={
    "first-name":"Jerome",//名:值
    "last-name":"Howard"
};
stooge["first-name"]//"Jerome"
stooge["middle-name"]//检索不存在的值 返回undefined
var flight ={
    airline:"Oceanic",
    number:815,
    departure:{
        IATA:"SYD",
        time:"2004-09-22 14:55",
        city:"Sydeny"
    },
    arrival:{
        IATA:"LAX",
        time:"2004-09-23 10:42",
        city:"Los Angeles"
    }
};
flight.departure.IATA //"SYD"

var middle = stooge["middle-name"] || "{none}";// || 用来填充默认值
var status = flight.status || "unknown";

flight.equipment //undefined
// flight.equipment.model //throw "TypeError"
flight.equipment && flight.equipment.model //undefined

stooge["first-name"]="Jer";
stooge["middle-name"]="Leater";
flight.equipment={
    model:'Boeing 777'//该属性将被扩充到对象中
};
flight.status='overdue';

var x=stooge;
x.nickname='Curly';
var nick=stooge.nickname;//x和stooge是指向听一个对象的引用, nick为'Curly'
var a={},b={},c={};//a、b和c每个都引用一个不同的空对象
a=b=c={};//a、b和c都引用同一个空对象

if(typeof Object.beget!=='function'){
    Object.beget=function(o){
        var F=function (){};
        F.prototype=o;
        return new F();
    };
}
var another_stooge=Object.beget(stooge);
another_stooge['first-name']='Harry';
another_stooge['middle-name']='Moses';
another_stooge.nickname='Moe';

stooge.profession='actor';
another_stooge.prototype //'actor'

typeof flight.number //'number'
typeof flight.status //'string'
typeof flight.arrival //'object'
typeof flight.manifeat //'undefined'
typeof flight.toString //'function'
typeof flight.manifeat //'function'
flight.hasOwnProperty('number') //true
flight.hasOwnProperty('constructor') //false

var name;
for(name in another_stooge){
    if(typeof another_stooge[name]!=='function'){
        document.writeln(name+':'+another_stooge[name]);
    }
}
var i;
var properties=[
    'first-name',
    'middle-name',
    'last-name',
    'profession'
];
for(i=0;i<properties.length;i+=1){
    document.writeln(properties[i]+':'+another_stooge[properties[i]]);
}

another_stooge.nickname //'Moe'
delete another_stooge.nickname;
another_stooge.nickname //'Curly'

// 全局变量
var MYAPP={};
MYAPP.stooge={
    "first-name":"Joe"
};
